<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
<div class="main_buyer">
    <div class="wrap_buyer">
    	<div class="layout_l">
        	<div class="member_info">
                <dl>
                	<dt><a href="main.php?m=member&s=admin_member"><{$cominfo.name}></a>&nbsp;(<{$smarty.cookies.USER}>)</dt>
                    <dd>
					账户余额<span class="price"><{$cash|number_format:2}></span>元
					<a href="main.php?m=payment&s=admin_accounts_bind">提现</a>
					<a href="main.php?m=payment&s=admin_accounts_cashflow">明细</a>
					</dd>
                </dl>
                <ul>
                    <li class="<{if $shop_count.order.0}>yes<{else}>no<{/if}>"><a href="main.php?m=product&s=admin_buyorder&status=1">待付款订单&nbsp;(<strong><{$shop_count.order.0}></strong>)</a></li>
                    <li class="<{if $shop_count.order.1}>yes<{else}>no<{/if}>"><a href="main.php?m=product&s=admin_buyorder&status=3">待确认收货&nbsp;(<strong><{$shop_count.order.1}></strong>)</a></li>
                    <li class="<{if $shop_count.order.2}>yes<{else}>no<{/if}>"><a href="main.php?m=product&s=admin_buyorder&status=4">待评价交易&nbsp;(<strong><{$shop_count.order.2}></strong>)</a></li>
                </ul>
            	<div class="clear"></div>
            </div>
            <div class="ad565"><script src='<{$config.weburl}>/api/ad.php?id=16&catid=<{$smarty.get.id}>&name=<{$smarty.get.key}>'></script></div>
            <div class="weibo">
            	<div class="charcount" id="weibo"></div>
            	<div class="weibopic"></div>
                <span class="form-error"></span>
                <form action="main.php?m=sns&s=sns" name="shareform" id="shareform" method="post">
                <input type="hidden" name="act" value="share">
                <div class="weibo_content">
                	<textarea name="content" id="content"></textarea>
                </div>
                <div class="weibo_button">
                    <span><a id="snssharegoods" href="javascript:void(0)">分享产品</a></span>
                	<input type="submit" id="btn" disabled="disabled" value="分享" class="button">
                    <div class="clear"></div>
                </div>
                </form>
            </div>
            <div class="tabmenu">
                <ul class="tab">
                	<li class="active"><a href="javascript:void(0)">好友动态</a><div></div></li>
                </ul>
            </div>
            <div class="friendtrace" id="friendtrace"></div>
        </div>
        
    	<div class="layout_r">
        	<div class="user_atten clearfix">
            	<ul>
                	<li><a href=""><strong><{$count.friend}></strong><span>关注 </span></a></li>
                	<li><a href=""><strong><{$count.fan}></strong><span>粉丝 </span></a></li>
                	<li class="li"><a href=""><strong><{$count.blog}></strong><span>微博 </span></a></li>
                </ul>
            </div>
            <div class="right_module">            
                <form class="right_module_title">
                    <fieldset><legend>可能感兴趣的人</legend></fieldset>
                </form>
                <div class="right_module_content">
                <{insert name="label" type="sns" temp="sns_list_1" limit=3}>
                </div>
            </div>
            
            <div class="right_module">            
                <form class="right_module_title">
                    <fieldset><legend>热门活动</legend></fieldset>
                </form>
                <div class="right_module_content ad174">
                <script src='<{$config.weburl}>/api/ad.php?id=14&catid=<{$smarty.get.id}>&name=<{$smarty.get.key}>'></script>
                </div>
            </div>
            
            <div class="right_module">            
                <form class="right_module_title">
                    <fieldset><legend>热门商品推荐</legend></fieldset>
                </form>
                <div class="right_module_content ad174">
                <script src='<{$config.weburl}>/api/ad.php?id=15&catid=<{$smarty.get.id}>&name=<{$smarty.get.key}>'></script>
                </div>
            </div>
            
            <div class="right_module">            
                <form class="right_module_title">
                    <fieldset><legend>公告栏</legend></fieldset>
                </form>
                <div class="right_module_content con">
                <{insert name="label" type="announcement" temp="notice_list" limit=5}>
                </div>
            </div>
        </div>
        <div class="clear"></div>
    </div>
</div>
<script>
//显示分享产品页面	
$('#snssharegoods').click(function(){	
	ajax_form("sharegoods", '<{$lang.share_buy_and_collection_of_baby}>', '<{$config.weburl}>/main.php?m=sns&s=sns&op=sharegoods', 500);
	return false;
});
$("#content").charCount({
	allowed: 140,
	warning: 10,
	counterContainerID:'weibo',
	firstCounterText:'还可以输入<span>',
	endCounterText:'</span>字',
	errorCounterText:'已经超出<span>'
});
$("[data_type='sns_forward']").live('click',function(){
	var data = $(this).attr('data-param');
	eval("data = "+data);
	ajax_form("forward_form", '<{$lang.forwarding}>', '<{$config.weburl}>/main.php?m=sns&s=sns&op=forward&bid='+data.bid, 500);
	return false;
});
$("[data_type='sns_comment']").live('click',function(){
	var data = $(this).attr('data-param');
	eval("data = "+data);
	ajax_form("comment_form", '评论', '<{$config.weburl}>/main.php?m=sns&s=sns&op=comment&bid='+data.bid, 500);
	return false;
});
$("[data_type='fd_del']").live('click',function(){
	message_confirm("confirm", "", "确认要删除这条微博吗?", 270, 0)
	var data_str = $(this).attr('data-param');
	eval("data_str = "+data_str);
	$(".btn1").live('click',function(){	
		var url = "<{$config.weburl}>/main.php?m=sns&s=sns";
		var pars = 'bid='+data_str.bid+'&op=del';
		$.post(url, pars,showResponse);
		function showResponse(originalRequest)
		{
			message_notice('notice', '<{$lang.message}>', '<{$lang.deleted_successfully}>', 270, 0)
			function closefunc()
			{
				DialogManager.close("notice");
				$('#friendtrace').lazyshow({url:"main.php?m=sns&s=sns&curpage=1",'iIntervalId':true});
			}
			setTimeout(closefunc,1000);
		}
	});
});
$("#shareform").bind('keyup',function(){	
	var text=$("#content").val();
	if(text)
	{
		$("#btn").attr('disabled','');
		$("#btn").addClass('nbg');	
	}
	else
	{
		$("#btn").attr('disabled','disabled');
		$("#btn").removeClass('nbg');	
	}
})
function $$(id) {
	return !id ? null : document.getElementById(id);
}
$("#btn").bind('click',function(){		
	formid='shareform';
	var ajaxframeid = 'ajaxframe';
	var ajaxframe = $$(ajaxframeid);
	if(!ajaxframe){
		var div = document.createElement('div');
		div.style.display = 'none';
		div.innerHTML = '<iframe name="' + ajaxframeid + '" id="' + ajaxframeid + '" loading="1"></iframe>';
		ajaxframe = $$(ajaxframeid);
		$$('append_parent').appendChild(div);
	}
	$$(formid).target = ajaxframeid;

	$('#'+formid).validate({
		errorPlacement: function(error, element){
			element.next('.form-error').append(error);
		},  
		rules : {
			content : {
				required:true,
				maxlength : 140
			}
		},
		messages : {
			content : {
				required: '不能为空!',
				maxlength: '不能超过140字'
			}
		}, 
		submitHandler:function(form){  
			form.submit();
			function closefunc()
			{
				$("#content").val('');
				DialogManager.close("notice");
				$('#friendtrace').lazyshow({url:"main.php?m=sns&s=sns&curpage=1",'iIntervalId':true});
			}
			var d = DialogManager.create('notice');
			d.setTitle('<{$lang.message}>');
			d.setContents('message', { type: 'notice', text: "<{$lang.share_successful}>" });
			d.setWidth(270);
			d.show('center');
			setTimeout(closefunc,800);
		}
			
	});
});
$('#friendtrace').lazyinit();
$('#friendtrace').lazyshow({url:"main.php?m=sns&s=sns&curpage=1",'iIntervalId':true});
</script>